package com.android.aqq.util;

import java.util.Comparator;

import com.android.aqq.bean.QQBuddy;


public class Comparators {
	public static Comparator getComparator() {
		return new Comparator() {
			public int compare(Object o1, Object o2) {
				if (o1 instanceof QQBuddy) {
					return compare((QQBuddy) o1, (QQBuddy) o2);
				}

				else {
					System.err.println("未找到合适的比较器");
					return 1;

				}
			}
			
			public int compare(QQBuddy o1, QQBuddy o2) {
//				if (Utils.getStatusOrder(o1.getStatus()) < Utils.getStatusOrder(o2.getStatus())) {
//					return -1;
//				} else if (Utils.getStatusOrder(o1.getStatus()) == Utils.getStatusOrder(o2.getStatus())){
//					return PinYin.getPinYinHeadChar(o1.toString()).compareTo(PinYin.getPinYinHeadChar(o2.toString()));
//				} else {
//					return 1;
//				}
				return Utils.getStatusOrder(o1.getStatus()) - Utils.getStatusOrder(o2.getStatus());
			}
			
		};
		
		
	}
	
	
}
